// 字体加载
const loadFont = (fontName: string, fontUrl: string) => {
  return async () => {
    const fontLoader = new FontFace(fontName, `url(${fontUrl})`)
    try {
      await fontLoader.load()
      document.fonts.add(fontLoader)
      return fontLoader
    } catch (error) {
      return Promise.reject(error)
    }
  }
}
const fontInfo = [
  { name: 'RZFont', url: '/font/锐字云字库行楷GB.ttf' },
  { name: 'XQFont', url: '/font/喜鹊聚珍体.ttf' },
]
export default async () => {
  await Promise.all(fontInfo.map(info => loadFont(info.name, info.url)()))
}
